/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef OHCRYPTO_ASYMKEY_TEST_H
#define OHCRYPTO_ASYMKEY_TEST_H

#include <stdbool.h>

#include "crypto_common.h"
#include "crypto_asym_key.h"
#include "crypto_framework_common_test.h"


typedef struct AsymKeySpec {
    uint8_t *algName;
    const char *name;
} AsymKeySpec;

typedef struct {
    const char *pubType;
    uint8_t *algName;
    uint8_t *algKeyName;
    uint8_t *password;
    int32_t pwLen;
    uint8_t *cipher;
    int32_t cipherLen;
    uint8_t *type;
    Crypto_EncodingType encoding;
} AsymPrivKeySpec;

typedef struct {
    const char *algoName;
    const char *curve;
    const char *curveNid;
    bool isGetCommonSpec;
} CommonECCSpec;

typedef struct {
    const char *curve;
    const char *curveNid;
    const char *format;
} ECPointSpec;

typedef struct {
    const char *specName;
    const char *algoName;
    const char *algoKeyName;
} CommonRSASpec;

typedef struct {
    const char *algoName;
    const char *curve;
    int pLen;
    int skLen;
    bool isGetCommonSpec;
} CommonDHSpec;

typedef struct {
    const char *specName;
    const char *algoName;
} CommonDSASpec;

typedef struct {
    const char *algoName;
    CryptoAsymKey_ParamType sk;
    CryptoAsymKey_ParamType pk;
} CommonSpec;

/* PBKDF2 > HKDF */
static uint8_t g_privData[] = {
    0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x45, 0x4e, 0x43, 0x52, 0x59,
    0x50, 0x54, 0x45, 0x44, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59,
    0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x4d, 0x49, 0x49, 0x43, 0x33, 0x44, 0x42, 0x57, 0x42, 0x67,
    0x6b, 0x71, 0x68, 0x6b, 0x69, 0x47, 0x39, 0x77, 0x30, 0x42, 0x42, 0x51, 0x30, 0x77, 0x53, 0x54,
    0x41, 0x6f, 0x42, 0x67, 0x67, 0x71, 0x68, 0x6b, 0x69, 0x47, 0x39, 0x77, 0x30, 0x43, 0x43, 0x54,
    0x41, 0x63, 0x42, 0x41, 0x69, 0x47, 0x70, 0x59, 0x36, 0x38, 0x4e, 0x54, 0x52, 0x73, 0x57, 0x51,
    0x49, 0x43, 0x43, 0x41, 0x41, 0x77, 0x0a, 0x44, 0x41, 0x59, 0x49, 0x4b, 0x6f, 0x5a, 0x49, 0x68,
    0x76, 0x63, 0x4e, 0x41, 0x67, 0x6b, 0x46, 0x41, 0x44, 0x41, 0x64, 0x42, 0x67, 0x6c, 0x67, 0x68,
    0x6b, 0x67, 0x42, 0x5a, 0x51, 0x4d, 0x45, 0x41, 0x51, 0x49, 0x45, 0x45, 0x46, 0x71, 0x4e, 0x67,
    0x69, 0x7a, 0x69, 0x44, 0x2b, 0x41, 0x65, 0x50, 0x76, 0x58, 0x46, 0x74, 0x71, 0x67, 0x6c, 0x44,
    0x58, 0x6b, 0x45, 0x67, 0x67, 0x4b, 0x41, 0x0a, 0x30, 0x4f, 0x43, 0x57, 0x6f, 0x73, 0x50, 0x69,
    0x4f, 0x6d, 0x52, 0x75, 0x68, 0x39, 0x54, 0x56, 0x2b, 0x51, 0x51, 0x30, 0x6c, 0x58, 0x2b, 0x4e,
    0x6c, 0x38, 0x68, 0x45, 0x61, 0x54, 0x74, 0x6d, 0x71, 0x70, 0x58, 0x42, 0x4a, 0x4c, 0x7a, 0x47,
    0x33, 0x73, 0x42, 0x5a, 0x36, 0x33, 0x4d, 0x50, 0x56, 0x4a, 0x57, 0x56, 0x6e, 0x76, 0x32, 0x56,
    0x31, 0x62, 0x43, 0x43, 0x30, 0x2b, 0x37, 0x49, 0x0a, 0x38, 0x61, 0x49, 0x36, 0x30, 0x79, 0x57,
    0x69, 0x53, 0x58, 0x35, 0x4b, 0x75, 0x79, 0x45, 0x2f, 0x7a, 0x33, 0x52, 0x36, 0x51, 0x4a, 0x69,
    0x45, 0x71, 0x52, 0x34, 0x75, 0x65, 0x69, 0x4e, 0x46, 0x70, 0x70, 0x51, 0x42, 0x4e, 0x4d, 0x6a,
    0x47, 0x49, 0x77, 0x70, 0x4f, 0x34, 0x6f, 0x52, 0x37, 0x47, 0x53, 0x4a, 0x65, 0x6d, 0x7a, 0x68,
    0x4e, 0x4b, 0x34, 0x38, 0x7a, 0x30, 0x54, 0x68, 0x74, 0x0a, 0x2b, 0x51, 0x2f, 0x69, 0x50, 0x46,
    0x72, 0x32, 0x58, 0x57, 0x78, 0x72, 0x72, 0x47, 0x32, 0x59, 0x62, 0x35, 0x4f, 0x41, 0x46, 0x30,
    0x6e, 0x48, 0x77, 0x71, 0x51, 0x55, 0x55, 0x38, 0x5a, 0x7a, 0x6e, 0x62, 0x38, 0x77, 0x73, 0x48,
    0x36, 0x6c, 0x56, 0x64, 0x6c, 0x43, 0x37, 0x55, 0x39, 0x33, 0x32, 0x41, 0x63, 0x4d, 0x50, 0x6f,
    0x61, 0x32, 0x57, 0x4f, 0x6d, 0x42, 0x49, 0x62, 0x4c, 0x43, 0x0a, 0x39, 0x51, 0x6c, 0x4a, 0x72,
    0x61, 0x70, 0x77, 0x30, 0x33, 0x5a, 0x2b, 0x78, 0x44, 0x56, 0x2f, 0x67, 0x49, 0x2b, 0x72, 0x4e,
    0x44, 0x30, 0x4a, 0x51, 0x70, 0x48, 0x77, 0x52, 0x5a, 0x52, 0x51, 0x44, 0x6c, 0x70, 0x42, 0x57,
    0x44, 0x70, 0x44, 0x46, 0x5a, 0x38, 0x54, 0x42, 0x4a, 0x58, 0x50, 0x76, 0x67, 0x75, 0x6b, 0x50,
    0x78, 0x52, 0x72, 0x73, 0x2b, 0x6b, 0x57, 0x71, 0x42, 0x62, 0x32, 0x0a, 0x78, 0x53, 0x53, 0x42,
    0x73, 0x46, 0x62, 0x38, 0x4f, 0x78, 0x77, 0x45, 0x43, 0x50, 0x6d, 0x44, 0x73, 0x57, 0x49, 0x49,
    0x41, 0x41, 0x43, 0x6a, 0x31, 0x6b, 0x6e, 0x73, 0x62, 0x70, 0x72, 0x36, 0x32, 0x64, 0x6c, 0x39,
    0x66, 0x70, 0x58, 0x37, 0x4a, 0x71, 0x74, 0x71, 0x2b, 0x4f, 0x58, 0x53, 0x45, 0x34, 0x6e, 0x57,
    0x67, 0x45, 0x76, 0x53, 0x2f, 0x42, 0x41, 0x77, 0x63, 0x59, 0x78, 0x52, 0x0a, 0x4f, 0x34, 0x4e,
    0x66, 0x6b, 0x2b, 0x52, 0x46, 0x79, 0x4e, 0x2f, 0x52, 0x54, 0x4e, 0x58, 0x6f, 0x6c, 0x70, 0x4b,
    0x2f, 0x69, 0x77, 0x4c, 0x55, 0x65, 0x62, 0x6d, 0x59, 0x51, 0x71, 0x61, 0x2f, 0x6e, 0x68, 0x78,
    0x58, 0x62, 0x56, 0x73, 0x41, 0x42, 0x4d, 0x52, 0x78, 0x65, 0x49, 0x37, 0x76, 0x71, 0x59, 0x63,
    0x4f, 0x2b, 0x72, 0x73, 0x63, 0x33, 0x58, 0x4e, 0x53, 0x7a, 0x31, 0x69, 0x58, 0x0a, 0x42, 0x65,
    0x44, 0x4b, 0x4f, 0x31, 0x36, 0x34, 0x57, 0x69, 0x32, 0x37, 0x32, 0x43, 0x34, 0x54, 0x75, 0x37,
    0x34, 0x37, 0x6c, 0x41, 0x47, 0x47, 0x6b, 0x75, 0x67, 0x67, 0x59, 0x6c, 0x4b, 0x34, 0x52, 0x6a,
    0x64, 0x57, 0x44, 0x51, 0x75, 0x52, 0x44, 0x6c, 0x33, 0x35, 0x49, 0x30, 0x78, 0x6b, 0x70, 0x6c,
    0x35, 0x6c, 0x43, 0x69, 0x73, 0x6f, 0x59, 0x6b, 0x74, 0x37, 0x51, 0x6a, 0x74, 0x4c, 0x0a, 0x2f,
    0x7a, 0x45, 0x53, 0x62, 0x57, 0x46, 0x74, 0x43, 0x6e, 0x36, 0x52, 0x4e, 0x49, 0x49, 0x53, 0x68,
    0x42, 0x56, 0x74, 0x76, 0x75, 0x53, 0x73, 0x6b, 0x51, 0x36, 0x63, 0x67, 0x67, 0x4b, 0x74, 0x59,
    0x53, 0x6f, 0x72, 0x68, 0x62, 0x74, 0x2f, 0x67, 0x57, 0x6c, 0x71, 0x68, 0x63, 0x61, 0x2b, 0x73,
    0x77, 0x63, 0x31, 0x4e, 0x4c, 0x6f, 0x4f, 0x44, 0x2b, 0x63, 0x33, 0x57, 0x48, 0x6d, 0x58, 0x0a,
    0x2f, 0x77, 0x73, 0x34, 0x55, 0x68, 0x58, 0x42, 0x74, 0x50, 0x47, 0x73, 0x54, 0x4a, 0x46, 0x62,
    0x74, 0x2b, 0x4b, 0x61, 0x56, 0x36, 0x31, 0x6c, 0x44, 0x70, 0x36, 0x37, 0x30, 0x34, 0x35, 0x6d,
    0x66, 0x50, 0x58, 0x6a, 0x6b, 0x33, 0x68, 0x52, 0x4b, 0x52, 0x6e, 0x59, 0x56, 0x59, 0x4c, 0x37,
    0x30, 0x52, 0x7a, 0x73, 0x2b, 0x78, 0x30, 0x50, 0x54, 0x6b, 0x67, 0x5a, 0x39, 0x30, 0x5a, 0x66,
    0x0a, 0x2f, 0x48, 0x73, 0x37, 0x67, 0x67, 0x47, 0x6a, 0x33, 0x59, 0x6f, 0x4b, 0x34, 0x46, 0x6c,
    0x64, 0x45, 0x75, 0x44, 0x63, 0x55, 0x61, 0x46, 0x35, 0x53, 0x67, 0x52, 0x55, 0x56, 0x43, 0x37,
    0x41, 0x4f, 0x32, 0x4f, 0x43, 0x59, 0x47, 0x55, 0x57, 0x77, 0x70, 0x73, 0x6d, 0x41, 0x37, 0x50,
    0x34, 0x72, 0x32, 0x70, 0x46, 0x68, 0x7a, 0x48, 0x75, 0x52, 0x47, 0x47, 0x31, 0x6c, 0x6a, 0x57,
    0x78, 0x0a, 0x6f, 0x4f, 0x78, 0x44, 0x54, 0x44, 0x44, 0x33, 0x55, 0x39, 0x61, 0x77, 0x57, 0x57,
    0x6c, 0x78, 0x70, 0x56, 0x33, 0x77, 0x64, 0x61, 0x35, 0x49, 0x42, 0x6f, 0x52, 0x7a, 0x4b, 0x30,
    0x54, 0x42, 0x77, 0x33, 0x51, 0x4f, 0x39, 0x4e, 0x64, 0x73, 0x4b, 0x75, 0x55, 0x41, 0x6f, 0x59,
    0x5a, 0x73, 0x61, 0x4c, 0x34, 0x39, 0x62, 0x51, 0x63, 0x37, 0x49, 0x31, 0x7a, 0x2b, 0x53, 0x4d,
    0x2b, 0x52, 0x0a, 0x74, 0x71, 0x5a, 0x31, 0x30, 0x54, 0x32, 0x56, 0x2b, 0x51, 0x30, 0x6e, 0x46,
    0x2b, 0x4e, 0x32, 0x74, 0x72, 0x4c, 0x62, 0x2f, 0x4e, 0x50, 0x52, 0x4d, 0x62, 0x55, 0x69, 0x39,
    0x44, 0x35, 0x49, 0x70, 0x62, 0x30, 0x42, 0x6c, 0x63, 0x6c, 0x76, 0x2f, 0x2f, 0x73, 0x75, 0x61,
    0x75, 0x67, 0x62, 0x2b, 0x77, 0x66, 0x68, 0x48, 0x72, 0x43, 0x74, 0x7a, 0x5a, 0x61, 0x43, 0x4f,
    0x4f, 0x77, 0x69, 0x0a, 0x6f, 0x57, 0x56, 0x38, 0x59, 0x69, 0x67, 0x39, 0x6e, 0x42, 0x71, 0x6e,
    0x74, 0x6f, 0x56, 0x4c, 0x76, 0x4d, 0x4a, 0x6c, 0x64, 0x54, 0x65, 0x6a, 0x4a, 0x41, 0x56, 0x75,
    0x79, 0x57, 0x57, 0x35, 0x6f, 0x5a, 0x30, 0x61, 0x65, 0x49, 0x64, 0x69, 0x52, 0x77, 0x70, 0x34,
    0x4f, 0x35, 0x71, 0x31, 0x71, 0x64, 0x45, 0x58, 0x69, 0x64, 0x61, 0x58, 0x4a, 0x45, 0x55, 0x46,
    0x56, 0x62, 0x75, 0x79, 0x0a, 0x6e, 0x4e, 0x4b, 0x50, 0x37, 0x35, 0x65, 0x4a, 0x65, 0x4f, 0x32,
    0x48, 0x4e, 0x57, 0x56, 0x6d, 0x34, 0x6f, 0x43, 0x72, 0x72, 0x41, 0x3d, 0x3d, 0x0a, 0x2d, 0x2d,
    0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x45, 0x4e, 0x43, 0x52, 0x59, 0x50, 0x54, 0x45, 0x44,
    0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d,
    0x2d, 0x0a
};

static uint8_t g_privDerData[] = {
    0x30, 0x82, 0x02, 0x5c, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xa4, 0xa1, 0xba, 0x1a, 0x2e,
    0x73, 0x1c, 0x82, 0x06, 0x77, 0xa2, 0xd6, 0xef, 0xb9, 0x32, 0xfc, 0xcb, 0x60, 0x70, 0x70, 0x9e,
    0xdb, 0x91, 0xf2, 0x50, 0x3c, 0xfa, 0x4d, 0x83, 0xe3, 0x27, 0x50, 0x2a, 0xa6, 0xf2, 0x0a, 0x1e,
    0xe2, 0x72, 0x7d, 0xdd, 0x92, 0xd9, 0x62, 0x47, 0x53, 0x05, 0x34, 0xb8, 0x32, 0xf8, 0x82, 0x0a,
    0x11, 0x44, 0xec, 0xbd, 0xc7, 0x9b, 0x94, 0x08, 0x7e, 0x22, 0x5f, 0x67, 0x58, 0xe1, 0x5c, 0x1a,
    0x5a, 0x9e, 0x6f, 0xc2, 0xd3, 0x9b, 0xb9, 0xaa, 0xd2, 0xb9, 0x68, 0xc1, 0x64, 0x12, 0x97, 0xad,
    0x9a, 0x70, 0x9b, 0x50, 0x84, 0xdc, 0x42, 0x74, 0xe7, 0x03, 0x67, 0xae, 0x0f, 0xca, 0x7b, 0xec,
    0x00, 0x75, 0x52, 0x40, 0x51, 0x81, 0x29, 0x12, 0x5e, 0x83, 0x61, 0x19, 0xba, 0x40, 0x5b, 0x58,
    0x8c, 0x3b, 0xb2, 0x47, 0x9c, 0x5c, 0x79, 0x28, 0xaf, 0xd7, 0x4f, 0x02, 0x03, 0x01, 0x00, 0x01,
    0x02, 0x81, 0x80, 0x7e, 0xa2, 0x74, 0x4f, 0x6d, 0x49, 0x58, 0x35, 0x60, 0x1a, 0x28, 0x64, 0xe2,
    0x72, 0xf7, 0x98, 0x62, 0x2c, 0x25, 0x71, 0x4b, 0x90, 0xa3, 0xbb, 0xdb, 0x22, 0x7c, 0x7a, 0xa1,
    0xa7, 0x59, 0xf7, 0x1d, 0x47, 0xdb, 0x48, 0x13, 0xa7, 0xa5, 0xdf, 0xd1, 0x4f, 0x02, 0xed, 0xc8,
    0xe5, 0x40, 0x4c, 0xe4, 0x1f, 0x38, 0xee, 0x76, 0x26, 0x00, 0x79, 0x86, 0x25, 0x83, 0x33, 0xa4,
    0x30, 0xb9, 0xe8, 0xa2, 0x6e, 0xe2, 0xc6, 0x28, 0x17, 0x93, 0xba, 0xb1, 0x0c, 0xf4, 0x99, 0x18,
    0x12, 0xbd, 0x04, 0x6c, 0x01, 0xb1, 0x48, 0xbb, 0x3f, 0xc0, 0x92, 0x81, 0x01, 0x61, 0x47, 0x34,
    0x60, 0xb2, 0x71, 0xdb, 0xd2, 0x58, 0xf4, 0x80, 0x48, 0xad, 0x09, 0x30, 0x01, 0xda, 0x31, 0x82,
    0xd6, 0x2d, 0xd2, 0x83, 0x83, 0xc0, 0xf7, 0x9d, 0x0f, 0x52, 0xbc, 0xf5, 0x66, 0xd1, 0x77, 0x86,
    0x3c, 0x13, 0x09, 0x02, 0x41, 0x00, 0xd9, 0x8f, 0x08, 0xc5, 0x5f, 0x81, 0x53, 0x39, 0xf4, 0x0f,
    0x30, 0xb7, 0x10, 0xda, 0x54, 0x9a, 0xaf, 0x01, 0xfa, 0x90, 0x2e, 0xfb, 0xba, 0xbd, 0x4a, 0x17,
    0x87, 0xf5, 0xdf, 0x6f, 0x65, 0x99, 0xd1, 0x39, 0x45, 0x0d, 0x00, 0x03, 0x3f, 0xc3, 0xd3, 0x00,
    0x91, 0xbc, 0xba, 0x31, 0x75, 0xed, 0xa9, 0xf1, 0x9a, 0xe1, 0xdb, 0x63, 0x92, 0x25, 0xa0, 0x29,
    0xa1, 0xe1, 0xe9, 0xc5, 0x8c, 0x3b, 0x02, 0x41, 0x00, 0xc1, 0xb8, 0x9d, 0x4e, 0x14, 0xbd, 0x89,
    0x75, 0x45, 0x93, 0x2a, 0x70, 0x9b, 0xba, 0x6c, 0x60, 0x36, 0xb8, 0xfc, 0x87, 0x42, 0xc6, 0x7b,
    0xf6, 0xb5, 0x23, 0xd7, 0x24, 0x7e, 0x25, 0xfd, 0x4a, 0xf9, 0x6c, 0x24, 0x9d, 0xf9, 0xca, 0x78,
    0x80, 0xf2, 0xf8, 0x78, 0x93, 0x2e, 0xcb, 0x7b, 0x0b, 0xdd, 0x28, 0x6c, 0xc8, 0xbc, 0x26, 0x5c,
    0xe5, 0x94, 0x28, 0x30, 0xdd, 0xe2, 0xc5, 0xb3, 0xfd, 0x02, 0x40, 0x70, 0xef, 0x12, 0xfa, 0x82,
    0x0d, 0x3c, 0x0a, 0xc5, 0x6a, 0x6d, 0x3b, 0x5a, 0x80, 0x3b, 0x92, 0xe0, 0x6e, 0x02, 0x87, 0x7e,
    0x1c, 0x26, 0x5f, 0xc4, 0x6a, 0x5a, 0xa5, 0x83, 0x8a, 0xec, 0x0e, 0xe0, 0xd0, 0xfd, 0xcb, 0x35,
    0xca, 0x79, 0xfb, 0x49, 0x38, 0xee, 0x6e, 0x2d, 0xa9, 0x27, 0x32, 0x6c, 0x19, 0x82, 0xf0, 0xe3,
    0x55, 0xd8, 0xb3, 0xb7, 0x64, 0x65, 0x28, 0x44, 0x95, 0xcb, 0xa9, 0x02, 0x40, 0x16, 0xca, 0x3f,
    0x47, 0x56, 0x4d, 0x4e, 0x04, 0x8b, 0xe0, 0xda, 0x57, 0x51, 0x1a, 0xc7, 0x71, 0x32, 0x3e, 0xe5,
    0x06, 0x8c, 0xa6, 0x89, 0x22, 0xe7, 0x00, 0x86, 0x68, 0xf6, 0xa6, 0x45, 0x7c, 0x32, 0x87, 0xb4,
    0x6f, 0x19, 0x59, 0xe6, 0x7f, 0x55, 0x16, 0x42, 0x29, 0x1e, 0x92, 0x35, 0xb1, 0x99, 0x9d, 0x0d,
    0xdf, 0x37, 0xb3, 0x53, 0xae, 0x76, 0x95, 0x9b, 0xda, 0x1e, 0xb9, 0x9f, 0x89, 0x02, 0x41, 0x00,
    0x9f, 0x28, 0x74, 0x45, 0x91, 0x5d, 0x04, 0x13, 0xdd, 0xe8, 0x40, 0xa8, 0x03, 0xf0, 0x1e, 0xa2,
    0xeb, 0x97, 0x25, 0x86, 0x8c, 0xe1, 0xad, 0x73, 0xa0, 0x8e, 0x1d, 0x2e, 0x5e, 0x0d, 0xd7, 0x9a,
    0x64, 0xb9, 0x1d, 0xca, 0x3a, 0x8d, 0x2d, 0x56, 0x07, 0xfa, 0x8e, 0x4a, 0x6a, 0xcd, 0xad, 0xe3,
    0x94, 0x57, 0xe9, 0xb6, 0x51, 0x86, 0x65, 0xf2, 0x88, 0x2f, 0x03, 0xa3, 0xe6, 0xed, 0xe6, 0x84
};

#endif